#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    int n;
    cin>>n;
    int r[N];
    for(int i=1;i<=n;i++){
        cin>>r[i];
    }
    int cntof1=0,cntof2=0;
    for(int i=1;i<=n;i++){
        if(r[i]==1) cntof1++;
        if(r[i]==2) cntof2++;
    }
    if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }
    if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }if(cntof1<=cntof2){
        cout<<cntof2;
        return 0;
    }
    if(cntof1>cntof2){
        cout<<n-cntof2;
        return 0;
    }
    return 0;
}
